package com.wsoft.hr.pm.manager;

import cn.hutool.core.collection.CollUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.wsoft.core.service.RedisService;
import com.wsoft.hr.pm.entity.HrPmTemplateTargetHisEntity;
import com.wsoft.hr.pm.mapper.HrPmTemplateTargetHisMapper;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;

/**
 * @Author z001
 * @Date 2025年02月17日 15:06:35
 */
@Slf4j
@Service
public class HrPmTemplateTargetHisManager extends ServiceImpl<HrPmTemplateTargetHisMapper, HrPmTemplateTargetHisEntity> {

    @Resource
    private RedisService redisService;


    /**
     * 获取指标下的 指标历史记录
     * @param targetIds
     * @return
     */
    public List<HrPmTemplateTargetHisEntity> getByTemplateTargetId(List<Long> templateTargetIds){
        if(CollUtil.isEmpty(templateTargetIds)){
            return new ArrayList<>();
        }
        QueryWrapper<HrPmTemplateTargetHisEntity> query = new QueryWrapper<>();
        query.lambda().in(HrPmTemplateTargetHisEntity::getTemplateTargetId, templateTargetIds);
        return list(query);
    }
}
